package com.baitai.system.domain.vo;

import com.baitai.common.annotation.Excel;
import com.baitai.common.annotation.Excel.ColumnType;
import com.baitai.common.annotation.Excel.Type;
import com.baitai.common.annotation.Excels;
import com.baitai.common.core.domain.BaseEntity;
import com.baitai.common.core.domain.entity.SysDept;
import com.baitai.common.core.domain.entity.SysRole;
import com.baitai.common.xss.Xss;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * 用户对象 sys_user
 *
 * @author ruoyi
 */
public class SysUserVo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 部门ID
     */
    private Long deptId;

    /**
     * 用户账号
     */
    private String userName;

    /**
     * 用户昵称
     */
    private String nickName;

    /**
     * 用户sha1值
     */
    private String phoneSha1;

    /**
     * 用户邮箱
     */
    private String email;

    /**
     * 手机号码
     */
    private String phonenumber;

    /**
     * 用户性别
     */
    private String sex;

    /**
     * 用户头像
     */
    private String avatar;

    /**
     * 密码
     */
    private String password;

    /**
     * 帐号状态（0正常 1停用）
     */
    private String status;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
    private String delFlag;

    /**
     * 最后登录IP
     */
    @Excel(name = "最后登录IP", type = Type.EXPORT)
    private String loginIp;

    /**
     * 最后登录时间
     */
    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
    private Date loginDate;

    /**
     * 积分
     */
    private String userPoints;
    /**
     * 总积分
     */
    @Excel(name = "总积分")
    private String totalPoints;
    /**
     * 上级id
     */
    private String parentId;
    private String parentName;
    /**
     * 上级id
     */
    private String userLevel;

    private String appVersion;

    private String currentApkversion;

    private String qrCode;
    /**
     * 级别
     */
    private String ancestor;

    /**
     * app下载地址
     */
    private String appUrl;

    /**
     * 收益比例
     */
    private String yieldRate;
    /**
     * oss下载地址
     */
    private String ossUrl;
    private String isForce;

    /**
     * 广告位id1
     */
    private String placementIdOne;

    /**
     * 广告位id2
     */
    private String placementIdTwo;

    /**
     * 广告位id3
     */
    private String placementIdThree;

    private String packageVersion;

    /**
     * 包标签
     */
    private String packageTabs;

    /**
     * 插屏次数
     */
    private String placementTwoCount;

    /**
     * 包名
     */
    private String packageName;

    /**
     * 抽奖次数
     */
    private String prizeCount;

    /**
     * 邀请进展
     */
    private String prizeProgress;

    private String isPrivate;

    /** tobid开屏广告位 */
    @Excel(name = "tobid开屏广告位")
    private String tobidSplash;

    /** tobid插屏广告位 */
    @Excel(name = "tobid插屏广告位")
    private String tobidInner;

    /** tobid激励广告位 */
    @Excel(name = "tobid激励广告位")
    private String tobidReward;




    private SysDept dept;

    /**
     * 角色对象
     */
    private List<SysRole> roles;

    /**
     * 角色组
     */
    private Long[] roleIds;

    /**
     * 岗位组
     */
    private Long[] postIds;

    /**
     * 角色ID
     */
    private Long roleId;

    public SysUserVo() {

    }

    public SysUserVo(Long userId) {
        this.userId = userId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public boolean isAdmin() {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Long userId) {
        return userId != null && 1L == userId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getPhoneSha1() {
        return phoneSha1;
    }

    public void setPhoneSha1(String phoneSha1) {
        this.phoneSha1 = phoneSha1;
    }

    @Xss(message = "用户账号不能包含脚本字符")
    @NotBlank(message = "用户账号不能为空")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getLoginIp() {
        return loginIp;
    }

    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp;
    }

    public Date getLoginDate() {
        return loginDate;
    }

    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }

    public SysDept getDept() {
        return dept;
    }

    public void setDept(SysDept dept) {
        this.dept = dept;
    }

    public List<SysRole> getRoles() {
        return roles;
    }

    public void setRoles(List<SysRole> roles) {
        this.roles = roles;
    }

    public Long[] getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds) {
        this.roleIds = roleIds;
    }

    public Long[] getPostIds() {
        return postIds;
    }

    public void setPostIds(Long[] postIds) {
        this.postIds = postIds;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getUserPoints() {
        return userPoints;
    }

    public void setUserPoints(String userPoints) {
        this.userPoints = userPoints;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getUserLevel() {
        return userLevel;
    }

    public void setUserLevel(String userLevel) {
        this.userLevel = userLevel;
    }

    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public String getCurrentApkversion() {
        return currentApkversion;
    }

    public void setCurrentApkversion(String currentApkversion) {
        this.currentApkversion = currentApkversion;
    }

    public String getTotalPoints() {
        return totalPoints;
    }

    public void setTotalPoints(String totalPoints) {
        this.totalPoints = totalPoints;
    }

    public String getQrCode() {
        return qrCode;
    }

    public void setQrCode(String qrCode) {
        this.qrCode = qrCode;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public String getAncestor() {
        return ancestor;
    }

    public void setAncestor(String ancestor) {
        this.ancestor = ancestor;
    }

    public String getAppUrl() {
        return appUrl;
    }

    public void setAppUrl(String appUrl) {
        this.appUrl = appUrl;
    }

    public String getYieldRate() {
        return yieldRate;
    }

    public void setYieldRate(String yieldRate) {
        this.yieldRate = yieldRate;
    }

    public String getOssUrl() {
        return ossUrl;
    }

    public void setOssUrl(String ossUrl) {
        this.ossUrl = ossUrl;
    }

    public String getIsForce() {
        return isForce;
    }

    public void setIsForce(String isForce) {
        this.isForce = isForce;
    }

    public String getPlacementIdOne() {
        return placementIdOne;
    }

    public void setPlacementIdOne(String placementIdOne) {
        this.placementIdOne = placementIdOne;
    }

    public String getPlacementIdTwo() {
        return placementIdTwo;
    }

    public void setPlacementIdTwo(String placementIdTwo) {
        this.placementIdTwo = placementIdTwo;
    }

    public String getPlacementIdThree() {
        return placementIdThree;
    }

    public void setPlacementIdThree(String placementIdThree) {
        this.placementIdThree = placementIdThree;
    }

    public String getPackageVersion() {
        return packageVersion;
    }

    public void setPackageVersion(String packageVersion) {
        this.packageVersion = packageVersion;
    }

    public String getPackageTabs() {
        return packageTabs;
    }

    public void setPackageTabs(String packageTabs) {
        this.packageTabs = packageTabs;
    }

    public String getPlacementTwoCount() {
        return placementTwoCount;
    }

    public void setPlacementTwoCount(String placementTwoCount) {
        this.placementTwoCount = placementTwoCount;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getPrizeCount() {
        return prizeCount;
    }

    public void setPrizeCount(String prizeCount) {
        this.prizeCount = prizeCount;
    }

    public String getPrizeProgress() {
        return prizeProgress;
    }

    public void setPrizeProgress(String prizeProgress) {
        this.prizeProgress = prizeProgress;
    }

    public String getIsPrivate() {
        return isPrivate;
    }

    public void setIsPrivate(String isPrivate) {
        this.isPrivate = isPrivate;
    }

    public String getTobidSplash() {
        return tobidSplash;
    }

    public void setTobidSplash(String tobidSplash) {
        this.tobidSplash = tobidSplash;
    }

    public String getTobidInner() {
        return tobidInner;
    }

    public void setTobidInner(String tobidInner) {
        this.tobidInner = tobidInner;
    }

    public String getTobidReward() {
        return tobidReward;
    }

    public void setTobidReward(String tobidReward) {
        this.tobidReward = tobidReward;
    }

    @Override
    public String toString() {
        return "SysUserVo{" +
                "userId=" + userId +
                ", deptId=" + deptId +
                ", userName='" + userName + '\'' +
                ", nickName='" + nickName + '\'' +
                ", phoneSha1='" + phoneSha1 + '\'' +
                ", email='" + email + '\'' +
                ", phonenumber='" + phonenumber + '\'' +
                ", sex='" + sex + '\'' +
                ", avatar='" + avatar + '\'' +
                ", password='" + password + '\'' +
                ", status='" + status + '\'' +
                ", delFlag='" + delFlag + '\'' +
                ", loginIp='" + loginIp + '\'' +
                ", loginDate=" + loginDate +
                ", userPoints='" + userPoints + '\'' +
                ", totalPoints='" + totalPoints + '\'' +
                ", parentId='" + parentId + '\'' +
                ", parentName='" + parentName + '\'' +
                ", userLevel='" + userLevel + '\'' +
                ", appVersion='" + appVersion + '\'' +
                ", currentApkversion='" + currentApkversion + '\'' +
                ", qrCode='" + qrCode + '\'' +
                ", ancestor='" + ancestor + '\'' +
                ", appUrl='" + appUrl + '\'' +
                ", yieldRate='" + yieldRate + '\'' +
                ", ossUrl='" + ossUrl + '\'' +
                ", isForce='" + isForce + '\'' +
                ", placementIdOne='" + placementIdOne + '\'' +
                ", placementIdTwo='" + placementIdTwo + '\'' +
                ", placementIdThree='" + placementIdThree + '\'' +
                ", packageVersion='" + packageVersion + '\'' +
                ", packageTabs='" + packageTabs + '\'' +
                ", placementTwoCount='" + placementTwoCount + '\'' +
                ", packageName='" + packageName + '\'' +
                ", prizeCount='" + prizeCount + '\'' +
                ", prizeProgress='" + prizeProgress + '\'' +
                ", isPrivate='" + isPrivate + '\'' +
                ", tobidSplash='" + tobidSplash + '\'' +
                ", tobidInner='" + tobidInner + '\'' +
                ", tobidReward='" + tobidReward + '\'' +
                ", dept=" + dept +
                ", roles=" + roles +
                ", roleIds=" + Arrays.toString(roleIds) +
                ", postIds=" + Arrays.toString(postIds) +
                ", roleId=" + roleId +
                '}';
    }
}
